<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Домашнее Занятие 1</title>
    <script src="scr.js" defer></script>
</head>
<body>
<script>
    var numb = prompt("Введите 6 цифр Вашего билетика:");
    var sum, sum1, sum2, n1, n2, n3, n4, n5, n6;
    
    n1 = numb % 10;
    n2 = (numb % 100 - n1) / 10;
    n3 = (numb % 1000 - n2*10 - n1) / 100;
    n4 = (numb % 10000 - n3*100 - n2*10 - n1) / 1000;
    n5 = (numb % 100000 - n4*1000 - n3*100 - n2*10 - n1) / 10000;
    n6 = (numb % 1000000 - n5*10000 - n4*1000 - n3*100 - n2*10 - n1) / 100000;

    sum1 = n1 + n2 + n3;
    sum2 = n4 + n5 + n6;
    sum = sum1 === sum2 ? "ПОЗДРАВЛЯЕМ!!! Ваш билетик СЧАСТЛИВЫЙ!!!" : "Увы и АХ=(";

    alert(sum);
</script>
</body>
</html>